<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page import="com.xy.weixin.tuling.entity.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>图灵机器人</title>
</head>
<body>
	<h1>机器人说：</h1>
	<%
		BaseEntity<?> baseEntity = (BaseEntity<?>) request
				.getAttribute("info");
		if (baseEntity != null) {
			switch (baseEntity.getCode()) {
			case 100000: //文本类数据
				out.println("Text:" + baseEntity.getText().trim());
				break;
			case 305000: //列车
				BaseEntity<TrainEntity> trainEntity = (BaseEntity<TrainEntity>) baseEntity;
				//out.println("Text:" + trainEntity.getCode());
				//detailurl:http://touch.qunar.com/h5/train/
				for (TrainEntity entity : trainEntity.getList()) {
					out.println("trainnum:" + entity.getTrainnum()
							+ " start:" + entity.getStart() + " terminal:"
							+ entity.getTerminal() + " starttime:"
							+ entity.getStarttime() + " endtime:"
							+ entity.getEndtime() + " detailurl:"
							+ entity.getDetailurl() + " icon:"
							+ entity.getIcon());
					out.println("<br/>");
				}
				out.println("您可以通过网址查询具体信息，请点击<a href='http://touch.qunar.com/h5/train/'>打开网址</a>");
				break;
			case 306000: //航班
				BaseEntity<FlightEntity> flightEntity = (BaseEntity<FlightEntity>) baseEntity;
				//out.println("Text:" + flightEntity.getCode());
				//detailurl:http://touch.qunar.com/h5/flight/
				for (FlightEntity entity : flightEntity.getList()) {
					out.println("flight:" + entity.getFlight() + " route:"
							+ entity.getRoute() + " starttime:"
							+ entity.getStarttime() + " endtime:"
							+ entity.getEndtime() + " state:"
							+ entity.getState() + " detailurl:"
							+ entity.getDetailurl() + " icon:"
							+ entity.getIcon());
					out.println("<br/>");
				}
				out.println("<br/>您可以通过网址查询具体信息，请点击<a href='http://touch.qunar.com/h5/flight/'>打开网址</a>");
				break;
			case 200000: //网址类数据
				//请点击 <a href="+baseEntity.getUrl()+">打开页面</a>
				/*
				out.println("Text:" + baseEntity.getText());
				out.println("Url:" + baseEntity.getUrl());
				*/
				out.println("<a href='"+baseEntity.getUrl()+"'>"+baseEntity.getText()+"</a>");
				break;
			case 302000: //新闻
				BaseEntity<NewsEntity> newsEntity = (BaseEntity<NewsEntity>) baseEntity;
				//out.println("Text:" + newsEntity.getCode());
				for (NewsEntity entity : newsEntity.getList()) {
					/*
					out.println("article:" + entity.getArticle()
							+ " source:" + entity.getSource()
							+ " detailurl:" + entity.getDetailurl()
							+ " icon:" + entity.getIcon());
					*/
					out.println("<br/>");
					out.println("<a href='"+entity.getDetailurl()+"'>"+entity.getArticle()+"</a>");
				}
				break;
			case 308000: //菜谱、视频、小说
				BaseEntity<InfoEntity> infoEntity = (BaseEntity<InfoEntity>) baseEntity;
				//out.println("Text:" + infoEntity.getCode());
				for (InfoEntity entity : infoEntity.getList()) {
					/*
					out.println("name:" + entity.getName() + " info:"
							+ entity.getInfo() + " detailurl:"
							+ entity.getDetailurl() + " icon:"
							+ entity.getIcon());
					*/
					out.println("<br/>");
					out.println("<a href='"+entity.getDetailurl()+"'>"+entity.getName()+"</a>");
				}
				break;
			default: //其他
				break;
			}
		} else {
			out.println("你说的太高深了哦！o(╯□╰)o");
		}
	%>
</body>
</html>